package ursaminor.lazywork.common.core;

import java.util.HashMap;
import java.util.Map;


public class ContextContainer {
	
	public static Object getValue(String key, String name) {
		Object result = null;
		if (key != null && name != null) {
			Map<String, Object> dataMap = ContextListener.getContainer().get(key);
			if (dataMap != null) {
				result = dataMap.get(name);
			} else {
				dataMap = new HashMap<String, Object>();
				ContextListener.getContainer().put(key, dataMap);
			}
		}
		return result;
	}

	public static void setValue(String key, String name, Object value) {
		if (key != null && name != null) {
			Map<String, Object> dataMap = ContextListener.getContainer().get(key);
			if (dataMap != null) {
				dataMap.put(name, value);
			} else {
				dataMap = new HashMap<String, Object>();
				ContextListener.getContainer().put(key, dataMap);
			}
		}
	}

}
